<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="http://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
    <title>hash</title>
    <style>
    table{width:100%;}
        table,td,tr{
            border:1px solid #ccc;
        }
        .hide{
            display: none;
        }
        .show{
            display: block;
        }
    </style>

</head>
<body>
<table>
    <thead>
        <tr>
        <th>1标题</th>
        <th>2姓名</th>
        <th>3年龄</th>
        </tr>
    </thead>
    <tbody>
        <tr class="aaa" name="aaa">
            <td>11</td>
            <td>11</td>
            <td>11</td>
        </tr>
        <tr class="aaa" name="aaa">
            <td  colspan="2">11</td>

            <td>11</td>
        </tr>
        <tr class="aaa" name="aaa">
            <td colspan="3">hhhhh</td>
        </tr>
        <tr class="bbb" name="bbb">
            <td>22</td>
            <td>22</td>
            <td>22</td>
        </tr>
                <tr class="bbb" name="bbb">
            <td>22</td>
            <td>22</td>
            <td>22</td>
        </tr>
                <tr class="bbb" name="bbb">
            <td>22</td>
            <td>22</td>
            <td>22</td>
        </tr>
        <tr class="ccc" name="ccc">
            <td>33</td>
            <td>33</td>
            <td>33</td>
        </tr>
        <tr class="ddd" name="ddd">
            <td>44</td>
            <td>44</td>
            <td>44</td>
        </tr>
    </tbody>



</table>
<div>
    <a href="#aaa">aaaa</a>
    <a href="#bbb">bbb</a>
    <a href="#ccc">ccc</a>
    <a href="#ddd">dddd</a>
</div>
<script>
    $(function(){
        hideSons()
        $(window).on('hashchange',function(){
            hideSons()
        })

    })

    function hideSons() {
        var hash = location.hash.replace("#","");
        names = $("tbody tr")
        hashs = []
        names.each(function(index,item){
            var className = $(item).attr('class')
            if(className == hash){
                $(item).show()
            }else{
                $(item).hide()
            }
        })

    }
</script>
</body>
</html>